<template>
  <div class="content mt10 flex-row">
    <a-button @click="handleBack">返回</a-button>
    <!-- 我的上报 -->
    <div class="flex-row" v-if="info.pageType === 'wdsb'">
      <a-button
        type="primary"
        @click="handleReportEdit"
        v-if="info.isEdit && info.buttonObj['bianji']"
        >编辑</a-button
      >
      <a-button type="primary" @click="handleOperation" v-if="!info.isEdit"
        >保存</a-button
      >
      <a-button
        type="primary"
        @click="handleOperation({ businessStatus: '0' })"
        v-if="
          (info.isEdit && info.buttonObj['zancun']) ||
          info.operationType === 'Report'
        "
        >暂存</a-button
      >
      <a-button
        type="primary"
        @click="handleOperation({ businessStatus: '1' })"
        v-if="
          (info.isEdit && info.buttonObj['shangbao']) ||
          info.operationType === 'Report'
        "
        >上报</a-button
      >
      <a-button
        type="primary"
        @click="handleOperation({ businessStatus: '2' })"
        v-if="
          (info.isEdit && info.buttonObj['zhijiebanjie']) ||
          info.operationType === 'Report'
        "
        >直接办结</a-button
      >
    </div>
    <!-- 精细化派遣 -->
    <div class="flex-row" v-if="info.pageType === 'jxhpq'">
      <a-button
        type="primary"
        @click="handleOperation('Temp')"
        v-if="info.buttonObj['paiqian']"
        >派遣</a-button
      >
    </div>
    <!-- 案件受理 -->
    <div class="flex-row" v-if="info.pageType === 'ajsl'">
      <a-button
        type="primary"
        @click="handleOperation('Accept')"
        v-if="info.buttonObj['deptshoulitongguo']"
        >受理</a-button
      >
      <a-button
        type="primary"
        @click="handleOperation('Reject')"
        v-if="info.buttonObj['deptshoulibohui']"
        >驳回</a-button
      >
    </div>
    <!-- 我的派遣单 -->
    <div class="flex-row" v-if="info.pageType === 'wdpqd'">
      <a-button
        type="primary"
        @click="handleOperation('Confirm')"
        v-if="info.buttonObj['userqueren']"
        >确认派遣</a-button
      >
      <a-button
        type="primary"
        @click="handleOperation('End')"
        v-if="info.buttonObj['userbanjie']"
        >派遣办结</a-button
      >
      <a-button
        type="primary"
        @click="handleOperation('Reback')"
        v-if="info.buttonObj['userfangongqueren']"
        >派遣办结</a-button
      >
    </div>
    <!-- 派遣单审核 -->
    <div class="flex-row" v-if="info.pageType === 'pqdsh'">
      <a-button
        type="primary"
        @click="handleOperation('Pass')"
        v-if="info.buttonObj['deptshenhetongguo']"
        >审核通过</a-button
      >
      <a-button
        type="primary"
        @click="handleOperation('Reject')"
        v-if="info.buttonObj['deptshenhebohui']"
        >审核驳回</a-button
      >
    </div>
    <!-- 案件审核 -->
    <div class="flex-row" v-if="info.pageType === 'ajsh'">
      <a-button
        type="primary"
        @click="handleOperation('Pass')"
        v-if="info.buttonObj['anjianshenhetongguo']"
        >案件审核通过</a-button
      >
      <a-button
        type="primary"
        @click="handleOperation('Reject')"
        v-if="info.buttonObj['anjianshenhebohui']"
        >案件审核驳回</a-button
      >
    </div>
    <!-- 案件归档 -->
    <div class="flex-row" v-if="info.pageType === 'ajgd'">
      <a-button
        type="primary"
        @click="handleOperation('guidang')"
        v-if="info.buttonObj['guidang']"
        >归档</a-button
      >
    </div>
    <!-- 我的待办 -->
    <div class="flex-row" v-if="info.pageType === 'wdrw'">
      <!-- 我的上报 -->
      <a-button type="primary" @click="handleReportEdit" v-if="info.isEdit && info.buttonObj['bianji']">编辑</a-button>
      <a-button type="primary" @click="handleOperation" v-if="!info.isEdit" >保存</a-button>
      <a-button type="primary" @click="handleOperation({ businessStatus: '0' })" v-if=" (info.isEdit && info.buttonObj['zancun']) ||  info.operationType === 'Report' ">暂存</a-button>
      <a-button type="primary" @click="handleOperation({ businessStatus: '1' })" v-if="(info.isEdit && info.buttonObj['shangbao']) || info.operationType === 'Report'">上报</a-button>
      <a-button type="primary" @click="handleOperation({ businessStatus: '2' })" v-if="(info.isEdit && info.buttonObj['zhijiebanjie']) || info.operationType === 'Report'">直接办结</a-button>
      <!-- 精细化派遣 -->
      <a-button type="primary" @click="handleOperation('Confirm')" v-if="info.buttonObj['userqueren']" >确认派遣</a-button>
      <a-button type="primary" @click="handleOperation('End')" v-if="info.buttonObj['userbanjie']" >派遣办结</a-button>
      <a-button type="primary" @click="handleOperation('Reback')" v-if="info.buttonObj['userfangongqueren']">派遣办结</a-button>
      <!-- 案件受理 -->
      <a-button type="primary" @click="handleOperation('Accept')" v-if="info.buttonObj['deptshoulitongguo']">受理</a-button>
      <a-button type="primary" @click="handleOperation('Reject')" v-if="info.buttonObj['deptshoulibohui']">驳回</a-button>
      <!-- 我的派遣单 -->
      <a-button type="primary" @click="handleOperation('Confirm')" v-if="info.buttonObj['userqueren']" >确认派遣</a-button>
      <a-button type="primary" @click="handleOperation('End')" v-if="info.buttonObj['userbanjie']" >派遣办结</a-button>
      <a-button type="primary" @click="handleOperation('Reback')" v-if="info.buttonObj['userfangongqueren']">派遣办结</a-button>
      <!-- 派遣单审核 -->
      <a-button type="primary" @click="handleOperation('Pass')" v-if="info.buttonObj['deptshenhetongguo']">审核通过</a-button>
      <a-button type="primary" @click="handleOperation('Reject')" v-if="info.buttonObj['deptshenhebohui']">审核驳回</a-button>
      <!-- 案件审核 -->
      <a-button type="primary" @click="handleOperation('Pass')" v-if="info.buttonObj['anjianshenhetongguo']">案件审核通过</a-button>
      <a-button type="primary" @click="handleOperation('Reject')" v-if="info.buttonObj['anjianshenhebohui']" >案件审核驳回</a-button>
      <!-- 案件归档 -->
      <a-button type="primary" @click="handleOperation('guidang')" v-if="info.buttonObj['guidang']">归档</a-button>
    </div>

  </div>
</template>
<script>
import qs from "qs";
export default {
  name: "CommonOperation",
  props: {
    info: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {
      buttonObj: {},
    };
  },
  mounted(){
    console.log('this',this.info)
  },
  methods: {
    handleReportEdit() {
      this.$emit("edit");
    },
    // 我的上报操作
    handleOperation(data) {
      this.$emit("submit", data);
    },
    // 返回
    handleBack() {
      this.$router.back();
    },
   
  },
};
</script>
<style scoped>
.flex-row {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
  justify-content: center;
}
</style>
